package com.gl.portal.system.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.transaction.annotation.Transactional;

import com.gl.portal.system.entity.SysRoleMenu;

public interface SysRoleMenuRepository extends JpaRepository<SysRoleMenu, Long>, JpaSpecificationExecutor<SysRoleMenu> {

	/**
	 * 查询菜单是否存在角色
	 *
	 * @param menuId
	 * @return
	 */
	int countByMenuId(Long menuId);

	@Transactional
	void deleteByRoleId(Long roleId);

	@Transactional
	void deleteByRoleIdIn(List<Long> roleIds);

	@Transactional
	void deleteByMenuId(Long menuId);

	List<SysRoleMenu> findByRoleIdIn(List<Long> roleIds);

}
